package io.github.uicdb.et.selection;

import com.mojang.serialization.Codec;
import io.github.uicdb.et.ElementalTheory;
import net.minecraft.core.Holder;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;

public record RandomSelection(String id,Holder<Attribute> attribute, double amount,AttributeModifier.Operation operation) {

    public static final Codec<RandomSelection> CODEC = ElementalTheory.RANDOM_SELECTION_REGISTRY.byNameCodec();
    public static final Codec<Holder<RandomSelection>> HOLDER_CODEC = ElementalTheory.RANDOM_SELECTION_REGISTRY.holderByNameCodec();
    public static final StreamCodec<RegistryFriendlyByteBuf,Holder<RandomSelection>> STREAM_CODEC = ByteBufCodecs.holderRegistry(ElementalTheory.RANDOM_SELECTION_REGISTRY_RESOURCE_KEY);
}
